home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr10 / inter35c.zip / WINHELP.ZIP / IDX2RTF.AWK < prev    next >
Text File  |  1993-02-08  |  2KB  |  61 lines

  1.  
  2.  
  3. BEGIN{
  4.   printf("{\\rtf\n")
  5.   printf("{\\fonttbl\n")
  6.   printf("\\f0\\froman Times New Roman;\n")
  7.   printf("\\f1\\fdecor Courier New;\n")
  8.   printf("\\f3\\fswiss Arial;\n")
  9. # printf("\\f4\\fnil Monospaced;}\n")
  10.   printf("\\f4\\fmodern Terminal;}\n")
  11.   printf("\\deff3\n")
  12.   printf("\\deftab1440")
  13.   count = 00002
  14. # 2 so that hc reports same topic numbers
  15.   col = 2
  16. # first line will be first column
  17. # chance maxcol to desired number of columns in by value index
  18.   maxcol = 4
  19.   lineend = ""
  20.  
  21. }
  22. {
  23. line = $0
  24.  
  25. if ($1 ~ /.freeze/) { next; };
  26.  
  27. if ($1 ~ /\\i\\p\\aUp/) { next };
  28.  
  29. if ($1 ~ /--/) { next };
  30.  
  31. if ($1 ~ /───/) { next };
  32.  
  33. if ($1 ~ /.context/) { sub("@IL", "_IL", $2); printf("\\pard\\page\n#{\\footnote _%sZ }\n+{\\footnote lev1:%-5.5d}\n", $2, count++); next };
  34.  
  35. if ($1 ~ /.topic/) { printf("${\\footnote %-4.4dI}\nK{\\footnote %s}\n\\par{\\f3\\fs28\\b%s}\n\\par \\tx1440\\tx2880\\tx4320 ", count, substr($0,7), substr($0,7) ); next };
  36.  
  37. # process jump ,references
  38. sub("\\\\a", "{\\uldb ", line);
  39. sub("\\\\b", "{\\b ", line);
  40. sub("\\\p", " } ", line);
  41. gsub("...\\\\a", "Z}│{\\uldb ", line);
  42. sub("\\\\v.$",    "Z}│"      , line);
  43. sub("\\\\v$",    "Z}"      , line);
  44. gsub("\\\\v",    "}{\\v _"      , line);
  45. gsub("@IL", "_IL", line);
  46. gsub("\t", "", line);
  47.  
  48. # convert to ansi char set
  49. ur = gsub("^\┌─", "\\brdrth \\box ", line);
  50. if (ur == 1) {sub("-.$", "", line); gsub(".─.", "", line);}
  51. sub("-.$", " \\par \\pard", line)
  52. gsub(".─.", "", line);          # found in many ATM packages
  53. gsub("─.", "", line);
  54. gsub("│", "| ", line);
  55. sub("^.$", "\\pard ",line)
  56. if ((ur == 1) || (line == "") || (line == "\pard ")) print line; else  print line "\par"
  57. }
  58. END {
  59.   printf("\\plain \\page\n}\n")
  60. }
  61.